package com.tenebrous.jestic.server;

import com.tenebrous.jestic.auth.AuthTokenGenerator;
import com.tenebrous.jestic.entity.server.JesticServer;
import com.tenebrous.jestic.enums.InstanceStatusEnum;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;
import java.util.Objects;

/**
 * @Description:
 * @Project: jestic-server
 * @Package: com.tenebrous.jestic
 * @Author: zhangya
 * @CreateTime: 2023-06-02  23:37
 * @Version: 1.0.0
 */
@Slf4j
public class ServerInstance extends Instance{


    public ServerInstance(AbstractInstanceContext instanceContext) {
        super(instanceContext);
    }

    @Override
    public Instance initInstance() {
        log.info("jestic: new instance request to join, initialize instance information");
        Instance instance = super.initInstance();
        // 注册到注册表中
        registerInstance(instance);
        instance.setInstanceStatus(InstanceStatusEnum.HEALTHY);
        flushInstance(instance);
        return instance;
    }
}
